package com.activiti6.demo.webservicetask;

import org.activiti.engine.impl.test.PluggableActivitiTestCase;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.test.Deployment;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

/**
 * 不能用！
 * org.activiti.engine.ActivitiException: no default process engine available
 */
@Deprecated
public class WebServiceTest extends PluggableActivitiTestCase {

    @Test
    @Deployment(resources = "processes/WebServiceTaskProcess.bpmn")
    public void test() {
        // 初始化参数
        Map<String, Object> vars = new HashMap<String, Object>();
        vars.put("nameVar", "mpc_test");
        ProcessInstance pi = runtimeService.startProcessInstanceByKey(
                "service1", vars);
        // 完成第一个任务
        Task task = taskService.createTaskQuery().singleResult();
        taskService.complete(task.getId());
        // 输出调用Web Service后的参数
        String add = (String) runtimeService.getVariable(pi.getId(), "addVar");
        System.out.println("↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓");
        System.out.println();
        System.out.println();
        System.out.println("mpc_test现在居住的地点是—————————————————————————>" + add);
        System.out.println();
        System.out.println();
        System.out.println("↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑");
    }

}
